package com.wmx.thread.dayOne;

public class PrintNum extends Thread {
    private PrintStuff num;
    public PrintNum (PrintStuff n){
        this.num = n;
    }
    @Override
    public void run(){
        synchronized (num) {
        while(num.num<=52) {

                if (num.flag) {
                    System.out.print(num.num);
                    num.num++;
                    System.out.print(num.num);
                    num.num++;
                    num.flag = false;
                    num.notify();
                } else
                    try {
                        num.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
            }
        }
    }

}
